﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class CMS_SearchTabs : System.Web.UI.UserControl
{
    Usas.Common.Cms.CurrentInfo cinfo = new Usas.Common.Cms.CurrentInfo();

    private ShowMode _CssClass = ShowMode.CmsManager;
    public enum ShowMode : int
    {
        CmsManager,
        CmsCheck,
        CmsTimeSheet,
        CmsAdmin,
        CmsEmail,
        CmsMyPublic,
        LinkButton2
    }

    public ShowMode CssClass
    {
        get
        {
            return _CssClass;
        }
        set
        {
            _CssClass = value;
        }
    }

    Usas.BLL.Cms.cmsType ct = new Usas.BLL.Cms.cmsType();
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ClassInit();
            switch(CssClass)
            {
                case ShowMode.CmsManager:
                    CmsManager.Attributes.Add("class", "current");
                    break;
                case ShowMode.CmsCheck:
                    CmsCheck.Attributes.Add("class", "current");
                    break;
                case ShowMode.CmsEmail:
                    break;
                case ShowMode.CmsTimeSheet:
                    CmsTimeSheet.Attributes.Add("class", "current");
                    break;
                case ShowMode.CmsMyPublic:
                    CmsMyPublic.Attributes.Add("class", "current");
                    break;
                case ShowMode.LinkButton2:
                    break;
                default:
                    break;
            }

            if (cinfo.GetAdminGroup())
            {
                liadmin.Visible = true;
            }
            else
            {
                liadmin.Visible = false;
            }

            if (cinfo.GetTimeSheetGroup())
            {
                litimesheet.Visible = true;
            }
            else
            {
                litimesheet.Visible = false;
            }
        }
    }




    protected void Search_Click(object sender, EventArgs e)
    {
        Response.Redirect("../WebClientMainFlow.aspx");
       

    }


    private void ClassInit()
    {
        CmsManager.Attributes.Remove("class");
        CmsCheck.Attributes.Remove("class");
        CmsTimeSheet.Attributes.Remove("class");
        CmsAdmin.Attributes.Remove("class");
        CmsEmail.Attributes.Remove("class");
        limypublic.Attributes.Remove("class");
        LinkButton2.Attributes.Remove("class");
    }

    protected void CmsTimeSheet_Click(object sender, EventArgs e)
    {
        try
        {
            Response.Redirect("TimeSheet.aspx");
        }
        catch
        { 
        }
    }
}
